package com.bprogram.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.bprogram.pojo.Partion;
import com.bprogram.service.PartionService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 分区表 前端控制器
 * </p>
 *
 * @author cai
 * @since 2023-11-21
 */
@RestController
@RequestMapping("/partion")
public class PartionController {


    @Resource
    private PartionService partionService;

    @GetMapping("/getPartion")
    public Partion getPartion(long id) {
        return partionService.getById(id);
    }

    @PostMapping("/saveOrUpdatePartion")
    public boolean saveOrUpdate( Partion partion) {
        return partionService.saveOrUpdate(partion);
    }

    /**
     * @param currentPage
     * @param pageSize
     * @param type        所属分区类型
     * @return
     */
    @PostMapping("/getPartionList")
    public List<Partion> getPartionList(String currentPage, String pageSize, String type) {
        return partionService.partionList(currentPage, pageSize, type);
    }

    @GetMapping("/delete")
    public boolean delete(long id) {
        return partionService.partionDelete(id);
    }

}

